package com.flowplan.excel.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * Excel解析结果DTO
 * 
 * @author FlowPlan Team
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExcelParseResult {
    
    /**
     * 是否解析成功
     */
    private Boolean success;
    
    /**
     * 错误信息
     */
    private String errorMessage;
    
    /**
     * 文件基本信息
     */
    private FileInfo fileInfo;
    
    /**
     * Sheet页数据
     */
    private List<SheetData> sheets;
    
    /**
     * 解析出的需求信息
     */
    private List<RequirementInfo> requirements;
    
    /**
     * 统计信息
     */
    private ParseStatistics statistics;
    
    /**
     * 文件信息内部类
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class FileInfo {
        private String fileName;
        private Long fileSize;
        private String fileType;
        private Integer sheetCount;
        private List<String> sheetNames;
    }
    
    /**
     * Sheet页数据内部类
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class SheetData {
        private String sheetName;
        private Integer rowCount;
        private Integer columnCount;
        private List<String> headers;
        private List<Map<String, Object>> rows;
    }
    
    /**
     * 需求信息内部类
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class RequirementInfo {
        private String title;
        private String description;
        private String priority;
        private String demander;
        private String deadline;
        private String category;
        private Map<String, Object> additionalInfo;
    }
    
    /**
     * 解析统计内部类
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ParseStatistics {
        private Integer totalRows;
        private Integer validRows;
        private Integer invalidRows;
        private Integer requirementCount;
        private Long parseTime;
    }
}